import { Element } from '../../../fieldType'
import commonField from '../../../propertyPanel/commonConfig'
export interface NumberElement extends Element {
  hint: string
  unit: string
  format: number
  defaultValue: string
  decimalPoint: number // 小数点几位
  width: number
  defaultType: number
  minNumber?: number
  maxNumber?: number
}
function formListFactory () {
  return [
    commonField.name,
    commonField.attrCode,
    { label: '单位', name: 'unit', type: 'input' },
    { label: '输入格式', name: 'format', type: 'select', subType: 'decimalPoint', data: [{ label: '数值', value: 1 }] },
    { label: '范围限制', name: 'numRange', type: 'numRange', fieldFixed: 'Number' },
    commonField.defaultValue,
    commonField.hint,
    commonField.width
  ]
}
const formList = formListFactory()
const formTemplate: NumberElement = {
  attrCode: '',
  businessId: '',
  name: '数字',
  unit: '',
  decimalPoint: 2,
  fieldType: 'number',
  hint: '',
  format: 1,
  defaultValue: '',
  defaultType: 1,
  width: 1,
  minNumber: undefined,
  maxNumber: undefined
}
export default {
  formList,
  formTemplate
}
